package cn.nn200433.mqtt.service;

import cn.nn200433.mqtt.config.MqttClientProperties;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;

/**
 * mqtt连接服务
 *
 * @author nn200433
 * @date 2023-04-12 012 16:23:27
 */
public interface IMqttConnectService {
    
    /**
     * 连接成功
     *
     * @param client     mqtt客户端（在连接成功时可以进行一些额外的主题订阅操作）
     * @param mqttConfig mqtt配置
     * @param reconnect  如果为 true，则连接是自动重新连接
     * @param serverURI  建立连接的服务器 URI
     * @param connectMsg 连接消息
     * @return
     * @author nn200433
     */
    public void connectComplete(MqttAsyncClient client, MqttClientProperties mqttConfig, boolean reconnect, String serverURI, String connectMsg);
    
    /**
     * 连接丢失
     *
     * @return {@link String }
     * @author nn200433
     */
    public void connectionLost(MqttAsyncClient client, MqttClientProperties mqttConfig, Throwable cause, String tryMsg);

}
